﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

namespace Macaw.Moss2007.CustomErrorPageSolution
{
    public class ThrowExceptionWebPart : System.Web.UI.WebControls.WebParts.WebPart
    {
        protected override void OnPreRender(EventArgs e)
        {
            if (SPContext.Current != null && SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Display)
            {
                throw new Exception(this.GetType().Name);
            }
            base.OnPreRender(e);
        }
    }
}
